<template>
  <div class="app-container">
    <table align="center">
      <caption class="title">
        履历表
      </caption>
      <tr>
        <td style="width: 100px;">姓名</td>
        <td style="width: 100px; ">{{form.staffName}}</td>
        <td style="width: 100px;">性别</td>
        <td style="width: 130px;">{{form.staffSex}}</td>

        <td style="width: 100px;">职别</td>
        <td style="width: 160px;">{{form.jobName}}</td>
        <td rowspan="3" style="width: 120px;">
					<image-preview :src="form.avatar" :width="120" :height="110" />
        </td>
      </tr>
      <tr>
        <td>入职时间</td>
        <td>{{parseTime(form.employmentTime,'{y}-{m}-{d}')}}</td>
        <td>出生年月</td>
        <td>{{form.birthDate}}</td>
        <td>工服尺码</td>
        <td>{{form.clothesSize}}</td>
      </tr>

      <tr>
        <td>联系电话</td>
        <td>{{form.staffPhone}}</td>
        <td>身份证号</td>
        <td colspan="3">{{form.staffIdcard}}</td>
      </tr>
			<tr>
        <td>紧急联系人</td>
        <td>{{form.urgentLinkman}}</td>
        <td>紧急联系电话</td>
        <td>{{form.urgentLinkmanPhone}}</td>
        <td>银行卡号</td>
        <td colspan="3">{{form.bankCard}}</td>
      </tr>
			<tr>
        <td>家庭住址</td>
        <td colspan="7">{{form.staffAddress}}</td>
      </tr>
      <tr>
        <td rowspan="3" colspan="4">
					<image-preview :src="form.imgIdcardPositive" width="98%" :height="160" />
				</td>
				<td rowspan="3" colspan="4">
					<image-preview :src="form.imgIdcardOppsite" width="98%" :height="160" />
				</td>
      </tr>
			<tr></tr>
			<tr></tr>
			<tr>
        <td rowspan="3" colspan="4">
					<image-preview :src="form.imgBankPositive" width="98%" :height="160"/>
				</td>
				<td rowspan="3" colspan="4">
					<image-preview :src="form.imgBankOppsite" width="98%" :height="160" />
				</td>
      </tr>
    </table>

		
  </div>
</template>
  
<script>
import { getStaff } from '@/api/cld/staff'
export default {
  name: "staffResumeView",
  props: {
    staffId: {
      type: Number
    }
  },
  data() {
    return {
        form: {},
    };
  },
  created() {
		this.getStaffInfo();
	},
  methods: {
		// 获取员工详情
    getStaffInfo() {
      getStaff(this.staffId).then(res => {
        this.form = res.data;
				this.parseCertificateNumber();
      })
    },
		parseCertificateNumber() {
			let birthday = "";
      let time = '';
      let sex = '';
      let age = '';
      let myDate = new Date()
         //根据身份证号码获取出生年月
      if (this.form.staffIdcard.length == 18) {
        birthday = IdNO.substr(6, 8);
        time = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
        this.form.birthDate = time
      }
    }
	},
};
</script>
<style scoped>
.title{
	font-size: 32px;
	color: black;
	font-weight: 600;
}
table{
    border-collapse: collapse;
		width: 100%;
    /* width: 590px; */
}
td{
    height: 30px;
    border: 1px solid black;
    text-align: center;
}
tr{
	height: 40px;
}
.pic{
    
    height: 180px;
}
</style>
  